﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThuVien;
using QuanLyThuVien.BUS;
using QuanLyThuVien.VO;

namespace QuanLyThuVien
{
    public partial class frmSuaSach : Form
    {
        public frmSuaSach()
        {
            InitializeComponent();
        }

        private void btnHuy_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnHoanThanhSua_Click(object sender, EventArgs e)
        {
            busSach busSach = new BUS.busSach();
            Sach Sach = new Sach(txtMaSach.Text, "", "", "");
            DataTable dt = busSach.TimSach(Sach);
            if (dt == null || dt.Rows.Count == 0)
            {
                MessageBox.Show("Khong ton tai trong CSDL");
                return;
            }
            Sach.NhaXuatBan = txtNhaXuatBan.Text;
            Sach.TacGia = txtTacGia.Text;
            Sach.TenSach = txtTenSach.Text;
            busSach.XoaSach(Sach);
        }
    }
}
